/**
 * 只显示日期
 * @param time
 * @returns
 */
export function timestamp(time?: string) {
  let timestamp = null;
  if (time) {
    let timeNow = time.substring(0, 19);
    timeNow = time.replace(/-/g, '/'); // 必须把日期'-'转为'/'
    timestamp = new Date(timeNow).getTime();
  } else {
    timestamp = Number(new Date());
  }

  return timestamp;
}
